package com.lilosoft.core.exception;

/**
 * 自定义 异常
 */
@SuppressWarnings("serial")
public class MyException extends RuntimeException {
	
	private int code = ErrCode.ERR_500.getCode();
	
	public MyException() {
		super();
	}
	
	public MyException(ErrCode errCode,String msg) {
		super(msg);
		this.code = errCode.getCode();
	}
	
	public MyException(ErrCode errCode,String msg, Throwable cause) {
		super(msg, cause);
		this.code = errCode.getCode();
	}
	
	public MyException(ErrCode errCode,Throwable cause) {
		super(cause);
		this.code = errCode.getCode();
	}
	
	public int getCode() {
		return code;
	}
	
	public MyException(String msg) {
		super(msg);
	}
	
	public MyException(String msg, Throwable cause) {
		super(msg, cause);
	}
	
	public MyException(Throwable cause) {
		super(cause);
	}

	public enum ErrCode {
		/**
		 * 业务错误
		 */
		ERR_500(500);

		private Integer code;

		private ErrCode(Integer code) {
			this.code = code;
		}

		public Integer getCode() {
			return code;
		}
	}
}
